package com.hfut.manage.controller;

import com.hfut.manage.pojo.LoginData;
import com.hfut.manage.pojo.Result;
import com.hfut.manage.service.ILoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


@RestController
@RequestMapping("/Login")
public class LoginController {

    @Autowired
    private ILoginService loginService;

    @PostMapping
    public Result login(@RequestBody LoginData loginData) {
        LoginData logindata =  loginService.lambdaQuery().eq(LoginData::getUsername, loginData.getUsername()).eq(LoginData::getPassword, loginData.getPassword()).one();
        if(logindata == null){
            return Result.error(500,"没有用户");
        }
        return Result.success(logindata);
    }


}
